package com.tian.view.anim

import android.content.Intent
import com.tian.view.BaseRecyclerAdapter
import com.tian.view.anim.attr_anim.AttrAnimActivity
import com.tian.view.anim.custom.CustomAnimActivity
import com.tian.view.anim.interpolator.InterpolatorActivity
import com.tian.view.anim.view_anim.ViewAnimActivity
import com.tian.view.anim.view_group_child.ViewGroupChildAnimActivity
import com.tian.view.common.BaseListActivity

/**
 * @author tiansongtao, Email:tiansongtao@up366.com
 * @date 2022/12/27 11:26
 *
 * 动画主UI
 */
class AnimActivity : BaseListActivity() {
    override fun getRecyclerViewAdapter(): BaseRecyclerAdapter {
        val adapter = BaseRecyclerAdapter()
        adapter.itemClickListener = object : BaseRecyclerAdapter.OnItemClickListener {
            override fun onItemClick(dataHolder: BaseRecyclerAdapter.DataHolder, position: Int) {
                val start = dataHolder.o1 as Class<*>
                startActivity(Intent(this@AnimActivity, start))
            }
        }
        return adapter
    }

    override fun getAdapterData(): MutableList<BaseRecyclerAdapter.DataHolder> {
        val datas = mutableListOf<BaseRecyclerAdapter.DataHolder>()
        datas.add(BaseRecyclerAdapter.DataHolder(BaseRecyclerAdapter.TYPE_COMMON_BUTTON, "视图动画",
                ViewAnimActivity::class.java))
        datas.add(BaseRecyclerAdapter.DataHolder(BaseRecyclerAdapter.TYPE_COMMON_BUTTON, "插值器",
                InterpolatorActivity::class.java))
        datas.add(BaseRecyclerAdapter.DataHolder(BaseRecyclerAdapter.TYPE_COMMON_BUTTON, "属性动画",
                AttrAnimActivity::class.java))
        datas.add(BaseRecyclerAdapter.DataHolder(BaseRecyclerAdapter.TYPE_COMMON_BUTTON, "ViewGroup子控件动画",
                ViewGroupChildAnimActivity::class.java))
        datas.add(BaseRecyclerAdapter.DataHolder(BaseRecyclerAdapter.TYPE_COMMON_BUTTON, "自定义动画",
                CustomAnimActivity::class.java))
        return datas
    }
}